<?
$id += 0;
$hotel = new Hotel();
$hotel->select($id);
$currency = new Currency();
$currency->select($hotel->getcurrency());
if ($hotel)
{
	if ($mod == 'description')	
	{
		echo $hotel->getdescription();
	}
	else if ($mod == 'rooms')
	{
		$cnt = 0;
		$rooms = $hotel->getAllRooms();
		foreach($rooms as $room)
		{
			$cnt ++;
		?>
        	<div style='padding:5px 0;'>
            	<div style='font-weight:bold;color:#2e3192;padding:5px 0 10px;font-size:12px;'><?=$cnt?>. <?=$room->getname()?></div>
                <div style='padding-bottom:5px; display:block; width:615px; overflow:hidden;'>
                	<div class='location_slide'>
                    	<ul>
                        <?
							$pictures = $room->getAllPictures();
							foreach($pictures as $picture)
							{
						?>
                        	<li><a rel='example_group' href='<?=$picture->getPath()?>'><img src='<?=$picture->getPath("loc_")?>' /></a></li>
                        <?
							}
						?>
                        </ul>
                    </div>
                </div>
                <div style='line-height:16px;'>
					<div><b>Loại giường : </b> <span style='color:#c00;'><?=$room->getbed_type()?></span></div>
					<div><b>Số khách ở tối đa : </b> <span style='color:#c00;'><?=$room->getnumber_customer()?></span></div>
                	<div>
                    	<b>Giá phòng: 
						<?
                        if ($room->getpromotion() > 0)
                        {
                        ?>
                            <span style='color:#c00;text-decoration:line-through;'> &nbsp; <span style='color:#333'><?=lg_number::money($currency->getVND($room->getprice()))?> VNĐ</span> &nbsp; </span>
                        <?
                        }
                        else
                        {
                        ?>
                            <span style='color:#c00;'><?=lg_number::money($currency->getVND($room->getprice()))?> VNĐ</span>
                        <?
                        }
                        ?>
                        </b>
                    </div>
                    <?
					if ($room->getpromotion() > 0)
					{
					?>
                    <div><b>Giảm giá:  <span style='color:#c00;'><?=($room->getpromotion())?></span></b></div>
                    <?
					}
					?>
                    <div><b>Giá thực tế:  <span style='color:#c00;'><?=lg_number::money($currency->getVND($room->getRealPrice()))?> VNĐ</span></b></div>
                	<?=$room->getdescription();?>
                </div>
				<div>
					<table>
					<?
						$facilities = Facility::getAllFacilities();
						$room_facility_ids = array();

						$room_facilities = RoomFacility::getAllFacilitiesForRoom($room->getid());
						foreach ($room_facilities as $facility)
							$room_facility_ids[] = $facility->getid();
							
						foreach ($facilities as $category => $facility_list) {
							echo "<tr class='tr_border'>";
							echo "<td align='right' valign='top'><div style='padding:10px'><b>".$category."</b></div></td>";
							echo "<td align='left'>";
							foreach ($facility_list as $facility) {
								echo "<div style='display:block;float:left;padding:5px;width:150px;'>";
								if (in_array($facility->getid(), $room_facility_ids))
									echo "<div style='display:block;float:left;width:24px;'><img src='/images/tick.png' /></div>";
								else
									echo "<div style='display:block;float:left;width:24px;padding-top:3px;'><img src='/images/tick_no.png' /></div>";
								echo "<div style='display:inline-block;float:left;'>".$facility->getdescription()."</div>";
								echo "</div>";
							}

							echo "<div style='clear:both'></div>";
							echo "</td>";
							echo "</tr>";
						}
					?>
					</table>
				</div>
            </div>
        <?
		}
	}
	else if ($mod == 'facilities')
	{
		echo "<table>";
		$facilities = Facility::getAllFacilities();
		$hotel_facility_ids = array();

		$hotel_facilities = HotelFacility::getAllFacilitiesForHotel($id);
		foreach ($hotel_facilities as $facility)
			$hotel_facility_ids[] = $facility->getid();
			
		foreach ($facilities as $category => $facility_list) {
			echo "<tr class='tr_border'>";
			echo "<td align='right' valign='top'><div style='padding:10px'><b>".$category."</b></div></td>";
			echo "<td align='left'>";
			foreach ($facility_list as $facility) {
				echo "<div style='display:block;float:left;padding:5px;width:150px;'>";
				if (in_array($facility->getid(), $hotel_facility_ids))
					echo "<div style='display:block;float:left;width:24px;'><img src='/images/tick.png' /></div>";
				else
					echo "<div style='display:block;float:left;width:24px;padding-top:3px;'><img src='/images/tick_no.png' /></div>";
				echo "<div style='display:block;float:left;'>".$facility->getdescription()."</div>";
				echo "</div>";
			}

			echo "<div style='clear:both'></div>";
			echo "</td>";
			echo "</tr>";
		}
		echo "</table>";
	}
	else if ($mod == 'booking')
	{
	?>
    	<div class='form_lien_he' style='float:none'>
        	<? include('z_includes/hotel_book.php')?>
        </div>
    <?
	}
	else if ($mod == 'map')
	{
	?>
    	<script type="text/javascript" src="/js/map.js"></script>
		<script type="text/javascript" src="/js/markerclusterer.js"></script>
        
        <script>
            $(document).ready(function() 
            {
                <?
                if ($hotel->getlatitude_x() != '' && $hotel->getlatitude_y() != '')
                {
                ?>
                var currentLocation = new google.maps.LatLng(16.066649,108.187494);
                initialize(currentLocation,"map_canvas");
                markerLocation = new google.maps.LatLng(<?=$hotel->getlatitude_x()?>,<?=$hotel->getlatitude_y()?>);
                image =  new google.maps.MarkerImage('/images/<?=$hotel->getstar()?>stars.png',
                // This marker is 20 pixels wide by 32 pixels tall.
                new google.maps.Size(32, 37),
                // The origin for this image is 0,0.
                new google.maps.Point(0,0),
                // The anchor for this image is the base of the flagpole at 0,32.
                new google.maps.Point(0, 0)); 
                placeMarker(markerLocation,image,"<?=htmlspecialchars_decode($hotel->getname())?>",<?=json_encode($hotel->getdescription())?>);
                <?
                }
                ?>
                map.fitBounds(bounds);
            });
        </script>
        <style>
            #map_canvas a{
                color:#000;
            }
            #map_canvas a:hover{
                color:#ff9600;
            }
        </style>
        <div id="map_canvas" style="width: 600; height: 400px; z-index:0;color:#000;margin:10px 0; "></div>
    <?
	}
}
?>

<script>
$(document).ready(function()
{
	$("a[rel=example_group]").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true
	});
	
	$(".location_slide").jcarousel({
		auto: 3,
        scroll: 1,
		wrap: 'circular',
		animation: 500,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});
</script>
<style>
	.tr_border td
	{
		border:1px solid #ccc;
	}
</style>